<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<div class="layui-header header">
    <div class="layui-container">
        <ul class="layui-nav">
            <li class="layui-nav-item">
                <a href="${pageContext.request.contextPath}/"><i class="layui-icon layui-icon-home"
                                                                 style="font-size: 13px;"></i>首页</a>
            </li>
            <%--<li class="layui-nav-item">
                <a href="${pageContext.request.contextPath}/"></a>
            </li>--%>
        </ul>
        <c:choose>
            <c:when test="${sessionScope.user==null}">
                <%--没登录状态--%>
                <ul class="layui-nav header-nav">
                    <li class="layui-nav-item">
                        <a href="${pageContext.request.contextPath}/user/login">登录</a>
                    </li>
                    <li class="layui-nav-item">
                        <a href="${pageContext.request.contextPath}/user/register">注册</a>
                    </li>
                </ul>
            </c:when>
            <c:otherwise>
                <%--已登录状态--%>
                <ul class="layui-nav header-nav">
                        <%-- <li class="layui-nav-item">
                             <a href="">通知<span class="layui-badge"><c:out value="${msgCount}" default="0"/></span></a>
                         </li>--%>
                    <li class="layui-nav-item">
                        <a href="">发布帖子</a>
                    </li>
                    <li class="layui-nav-item" lay-unselect="">
                        <a href="javascript:;">
                            <img src="${pageContext.request.contextPath}/${sessionScope.user.avatar}"
                                 class="layui-nav-img">${sessionScope.user.nickname}
                        </a>
                        <dl class="layui-nav-child">
                            <dd><a href="${pageContext.request.contextPath}/user/${sessionScope.user.id}">个人中心</a></dd>
                            <c:if test="${sessionScope.user.isAdmin}">
                                <dd><a href="${pageContext.request.contextPath}/admin/">后台管理</a></dd>
                            </c:if>

                            <dd><a href="${pageContext.request.contextPath}/user/logout">退了</a></dd>
                        </dl>
                    </li>
                </ul>
            </c:otherwise>
        </c:choose>
    </div>
</div>

